const tableFormater = (t, item) => {
  let res;
  if (t == "TableField") {
    res = {
      columns: [],
      data: [],
    };
    let list = item.value;
    list.filter((v, i) => {
      let rowObj = {};
      if (Array.isArray(v.rowValue)) {
        v.rowValue.filter((vv) => {

          if (i === 0) {
            let o = {
              title: vv.label,
              key: vv.key,
              dataIndex: vv.key,
              id: vv.key,
            };
            if (vv.key.includes("DDPhotoField")) {
              o["scopedSlots"] = {
                customRender: "img",
              };
            }
            res["columns"].push(o);
          }
          rowObj[vv.key] = vv.value;
        });
      }
      res["data"].push(rowObj);
    });
  } else {
  }
  return res;
};
export { tableFormater };
